#include <iostream>
using namespace std;

template <class T>
class ARRAY {
public:
	static T findMax(T arr[], int len);
	static T findMin(T arr[], int len);
	static T calcAvg(T arr[], int len);

private:
};

template <class T>
T ARRAY<T>::findMax(T arr[], int len) {
	T max = arr[0];
	for (int i = 1; i < len; i++) {
		if (max < arr[i]) {
			max = arr[i];
		}
	}
	return max;
}

template <class T>
T ARRAY<T>::findMin(T arr[], int len) {
	T min = arr[0];
	for (int i = 1; i < len; i++) {
		if (min > arr[i]) {
			min = arr[i];
		}
	}
	return min;
}

template <class T>
T ARRAY<T>::calcAvg(T arr[], int len) {
	T sum = (T) 0;
	for (int i = 1; i < len; i++) {
		sum += arr[i];
	}
	return (T) (sum / (T) len);
}

int main() {

	int arr[] = { 61, 17, 29, 22, 34, 60, 72, 21, 50, 1, 62 };
	cout << ARRAY<int>::findMax(arr, (int) sizeof(arr) / sizeof(*arr)) << endl;
	cout << ARRAY<int>::findMin(arr, (int) sizeof(arr) / sizeof(*arr)) << endl;
	cout << ARRAY<int>::calcAvg(arr, (int) sizeof(arr) / sizeof(*arr)) << endl;

	cout << "\n";

	double arrf[] = { 17.5, 19.1, 0.6, 1.9, 10.5, 12.4, 3.8, 19.7, 1.5, 25.4, 28.6, 4.4, 23.8, 5.4 };
	cout << ARRAY<double>::findMax(arrf, (int) sizeof(arrf) / sizeof(*arrf)) << endl;
	cout << ARRAY<double>::findMin(arrf, (int) sizeof(arrf) / sizeof(*arrf)) << endl;
	cout << ARRAY<double>::calcAvg(arrf, (int) sizeof(arrf) / sizeof(*arrf)) << endl;

	return 0;
}